﻿//===========================[ 8 / 5 / 2011 LVI ]=============================
//				Copyright c Vitaly Lyaschenko <SkyChameleon@gmail.com>
//								Source file
// Purpose: 
//=============================================================================
//#include "gl3com.h"
#include <GL/glew.h>
#include <GL/wglew.h>

#include "cVertexBuffer.h"

cVBO::cVBO(targetBuffer target, size_t size, const void *pData, usageBuffer usage )
{
	glGenBuffers( 1, &m_VBOid );

	glBindBuffer( m_target = target, m_VBOid );

	glBufferData( m_target, size, pData, usage );
}

void cVBO::Create(targetBuffer target, size_t size, const void *pData, usageBuffer usage )
{
	glGenBuffers( 1, &m_VBOid );

	glBindBuffer( m_target = target, m_VBOid );

	glBufferData( m_target, size, pData, usage );
}

void cVBO::Release()
{
	glDeleteBuffers( 1, &m_VBOid );
}

void cVBO::Unbind()
{
	glBindBuffer( m_target, 0 );
}

void cVBO::Clear()
{
	glBufferData( m_target, 0, NULL, 0 );
}

void cVBO::Bind()
{
	glBindBuffer( m_target, m_VBOid );
}